﻿
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class BL
    Dim da As Access = New Access

    ''' <summary>
    ''' 插入登录时间
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub insertDate(ByVal ip As String, ByVal addr As String)

        Dim tm As String = Now.ToString()
        da.DoSql("INSERT INTO log (logintime,IP,Addr) VALUES ('" + tm + "','" + ip + "','" + addr + "')")
    End Sub

    ''' <summary>
    ''' 插入留言
    ''' </summary>
    ''' <param name="msg"></param>
    ''' <remarks></remarks>
    Public Sub insertMsg(ByVal msg As String)

        Dim tm As String = Now.ToString()
        da.DoSql("INSERT INTO Message (mTime,Msg) VALUES ('" + tm + "','" + msg + "' )")
    End Sub

    ''' <summary>
    ''' 返回一小时内在线人数
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function rs() As DataSet
        Dim dt As DateTime = Now.AddHours(-1)
        Dim ds As DataSet = da.GetDs("select * from log where cdate(logintime)>'" + dt.ToString("yyyy/M/dd hh:mm:ss") + "'")
        Return ds
    End Function



    Public Function GetMsg(ByVal tt As Int16) As DataSet
        Dim dt As DateTime = Now.AddDays(tt)
        Dim ds As DataSet = da.GetDs("select * from Message where cdate(mtime)>'" + dt.ToString("yyyy/M/dd hh:mm:ss") + "'")
        ' Dim ds As DataSet = da.GetDs("select * from Message  ")
        Return ds
    End Function
End Class
